package com.wendu.oa.leave.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.wendu.oa.service.page.PageParam;
import org.springframework.format.annotation.DateTimeFormat;


import java.util.Date;


public class LeaveDto extends PageParam {

    private String l_id;
    private String e_id;
    private Date l_date;
    private Integer l_status;

    private Date l_start;
    private Date l_end;
    private String l_cause;

    private String l_spr;
    private String l_sp_advice;
    private Date l_sp_date;

    private Date l_back;

    private Date l_date_0;
    private Date l_date_1;

    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm",timezone = "GMT+8")
    //@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    public Date getL_start() {
        return l_start;
    }

    public void setL_start(Date l_start) {
        this.l_start = l_start;
    }
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm",timezone = "GMT+8")
    //@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    public Date getL_end() {
        return l_end;
    }

    public void setL_end(Date l_end) {
        this.l_end = l_end;
    }

    public String getL_cause() {
        return l_cause;
    }

    public void setL_cause(String l_cause) {
        this.l_cause = l_cause;
    }

    public String getL_id() {
        return l_id;
    }

    public void setL_id(String l_id) {
        this.l_id = l_id;
    }

    public String getE_id() {
        return e_id;
    }

    public void setE_id(String e_id) {
        this.e_id = e_id;
    }

    public Date getL_date() {
        return l_date;
    }

    public void setL_date(Date l_date) {
        this.l_date = l_date;
    }

    public Integer getL_status() {
        return l_status;
    }

    public void setL_status(Integer l_status) {
        this.l_status = l_status;
    }

    public String getL_spr() {
        return l_spr;
    }

    public void setL_spr(String l_spr) {
        this.l_spr = l_spr;
    }

    public String getL_sp_advice() {
        return l_sp_advice;
    }

    public void setL_sp_advice(String l_sp_advice) {
        this.l_sp_advice = l_sp_advice;
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    public Date getL_sp_date() {
        return l_sp_date;
    }

    public void setL_sp_date(Date l_sp_date) {
        this.l_sp_date = l_sp_date;
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    public Date getL_back() {
        return l_back;
    }

    public void setL_back(Date l_back) {
        this.l_back = l_back;
    }

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    public Date getL_date_0() {
        return l_date_0;
    }

    public void setL_date_0(Date l_date_0) {
        this.l_date_0 = l_date_0;
    }

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    public Date getL_date_1() {
        return l_date_1;
    }

    public void setL_date_1(Date l_date_1) {
        this.l_date_1 = l_date_1;
    }

    @Override
    public String toString() {

        try {
            return new ObjectMapper().writeValueAsString(this);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
            return "LeaveDto{" +
                    "l_id='" + l_id + '\'' +
                    ", e_id='" + e_id + '\'' +
                    ", l_date=" + l_date +
                    ", l_status=" + l_status +
                    ", l_start=" + l_start +
                    ", l_end=" + l_end +
                    ", l_cause='" + l_cause + '\'' +
                    ", l_spr='" + l_spr + '\'' +
                    ", l_sp_advice='" + l_sp_advice + '\'' +
                    ", l_sp_date=" + l_sp_date +
                    ", l_back=" + l_back +
                    ", l_date_0=" + l_date_0 +
                    ", l_date_1=" + l_date_1 +
                    '}';
        }

    }
}
